Fixing mixpanel & video file player

James Peret 8 years ago
parent
commit
8d617b650f

+ 2 - 2
app/scripts/controllers/contact.js

@@ -32,7 +32,7 @@ angular.module('goApp.contact', ['ngFx', 'ngAnimate', 'goApp.data', 'mandrill'])
32 32
     });
33 33
 
34 34
     $scope.sendMessage = function(msgData){
35
-      console.log("> Sending message from " + msgData.name)
35
+      console.log("> Sending message from " + msgData.name);
36 36
       Mandrill.sendMail(msgData);
37 37
       $mixpanel.track('Messsage Sent', { "Name": msgData.name, "email": msgData.email });
38 38
       if(!$scope.$$phase) {
@@ -42,7 +42,7 @@ angular.module('goApp.contact', ['ngFx', 'ngAnimate', 'goApp.data', 'mandrill'])
42 42
       } else {
43 43
         $scope.showSubmit = false;
44 44
       }
45
-    }
45
+    };
46 46
 
47 47
     // FadeIn
48 48
     $timeout(function(){

+ 1 - 6
app/scripts/controllers/navigation.js

@@ -11,16 +11,15 @@ angular.module('goApp.navigation', ['famous.angular', 'ngRoute', 'ngFx', 'ngAnim
11 11
   .controller('NavigationController',['$scope', '$rootScope', '$famous', '$timeline', '$http', '$location', '$route', '$timeout', 'Data', '$mixpanel', function ($scope,  $rootScope, $famous, $timeline, $http, $location, $route, $timeout, Data, $mixpanel) {
12 12
 
13 13
     'use strict';
14
+    $mixpanel.track('Index View');
14 15
 
15 16
     $rootScope.$on('background:loaded', function() {
16 17
       if(!$scope.$$phase) {
17 18
         $scope.$apply(function(){
18 19
           $scope.navigation = Data.getNavigation();
19
-          $scope.track();
20 20
         });
21 21
       } else {
22 22
         $scope.navigation = Data.getNavigation();
23
-        $scope.track();
24 23
       }
25 24
     });
26 25
 
@@ -78,8 +77,4 @@ angular.module('goApp.navigation', ['famous.angular', 'ngRoute', 'ngFx', 'ngAnim
78 77
       }
79 78
     };
80 79
 
81
-    $scope.track = function(){
82
-      $mixpanel.track('Index View');
83
-    }
84
-
85 80
   }]);

+ 12 - 12
app/scripts/controllers/video.js

@@ -21,7 +21,7 @@ angular.module('goApp.video', ['ngFx', 'ngAnimate', 'goApp.data'])
21 21
       var link = $location.url();
22 22
       $scope.pageData = Data.getPageData(link);
23 23
       console.log("> Youtube video: " + $scope.pageData.videoUrl);
24
-      if($scope.pageData.videoUrl != undefined){
24
+      if($scope.pageData.videoUrl !== undefined){
25 25
         $scope.startVideo();
26 26
       }
27 27
       $rootScope.$on('data:loaded', function(data) {
@@ -35,13 +35,13 @@ angular.module('goApp.video', ['ngFx', 'ngAnimate', 'goApp.data'])
35 35
           $scope.startVideo();
36 36
         }
37 37
       });
38
-    }
38
+    };
39 39
 
40 40
     $scope.fadeIn = function() {
41 41
       $timeout(function(){
42 42
         $scope.showView = true;
43 43
       },100);
44
-    }
44
+    };
45 45
 
46 46
     $scope.fadeOut = function() {
47 47
       $scope.showView = false;
@@ -52,28 +52,28 @@ angular.module('goApp.video', ['ngFx', 'ngAnimate', 'goApp.data'])
52 52
     };
53 53
 
54 54
     $scope.startVideo = function() {
55
-      if($scope.pageData.videoType == "youtube"){
55
+      if($scope.pageData.videoType === "file"){
56 56
         if(!$scope.$$phase) {
57 57
           $scope.$apply(function(){
58
-            $scope.showYoutube = true;
58
+            $scope.showFile = true;
59
+            $scope.startFileVideo();
59 60
           });
60 61
         } else {
61
-          $scope.showYoutube = true;
62
+          $scope.showFile = true;
63
+          $scope.startFileVideo();
62 64
         }
63 65
       }
64
-      if($scope.pageData.videoType == "file"){
66
+      if($scope.pageData.videoType === "youtube"){
65 67
         if(!$scope.$$phase) {
66 68
           $scope.$apply(function(){
67
-            $scope.showFile = true;
68
-            $scope.startFileVideo();
69
+            $scope.showYoutube = true;
69 70
           });
70 71
         } else {
71
-          $scope.showFile = true;
72
-          $scope.startFileVideo();
72
+          $scope.showYoutube = true;
73 73
         }
74 74
       }
75 75
       $mixpanel.track('Page View', { "Page": $scope.pageData.link });
76
-    }
76
+    };
77 77
 
78 78
     $scope.startFileVideo = function() {
79 79
       console.log("> Playing video " + $scope.pageData.videoUrl);

+ 5 - 5
app/scripts/services/mandrill.js

@@ -23,18 +23,18 @@ angular.module('mandrill', [])
23 23
           }
24 24
         ]
25 25
       }
26
-    }
26
+    };
27 27
     console.log(messagePost);
28 28
     $http.post('https://mandrillapp.com/api/1.0/messages/send.json', { key: messagePost.key, message: messagePost.message })
29 29
     .success(function(data, status, headers, config){
30 30
       $rootScope.$broadcast('email_sent:success');
31
-      console.log("> Message sent succesfully!")
32
-      console.log(data)
31
+      console.log("> Message sent succesfully!");
32
+      console.log(data);
33 33
     }).
34 34
     error(function(data, status, headers, config) {
35 35
       $rootScope.$broadcast('email_sent:error');
36
-      console.log("> There was an error whule sending the Message.")
37
-      console.log(data)
36
+      console.log("> There was an error whule sending the Message.");
37
+      console.log(data);
38 38
     });
39 39
   };
40 40